package cn.jobstart.controller;
import cn.jobstart.es.service.IResumeEsService;
import cn.jobstart.web.common.SkJsonResult;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.web.bind.annotation.RestController;
import cn.jobstart.pubInter.exception.SkException;
import cn.jobstart.pubInter.IBaseService;
import cn.jobstart.pubInter.RestfulController;
import cn.jobstart.dto.ResumeProfessionalSkillsDTO;
import cn.jobstart.dto.ResumeProfessionalSkillsPageDTO;
import cn.jobstart.modelExt.ResumeProfessionalSkillsExt;
import cn.jobstart.searchExt.ResumeProfessionalSkillsSearchExt;
import cn.jobstart.service.IResumeProfessionalSkillsService;
import cn.jobstart.vo.ResumeProfessionalSkillsDetailVO;
import cn.jobstart.vo.ResumeProfessionalSkillsListVO;
import cn.jobstart.vo.ResumeProfessionalSkillsDomainVO;
import cn.jobstart.vo.ResumeProfessionalSkillsDetailDomainVO;
import cn.jobstart.export.ResumeProfessionalSkillsDomainExport;
import cn.jobstart.controller.ApiManageController;
import org.springframework.validation.annotation.Validated;
import java.util.Set;
import java.util.HashSet;
import cn.jobstart.pubInter.exception.BusinessException;

/**
*    @author sunke
*    @Date 2023-09-06 15:00:21
*    @description ResumeProfessionalSkillsController      专业技能
*/
@Api(tags = "人才管理系统-专业技能相关", description = "专业技能相关接口")
@RestController(value ="resumeProfessionalSkillsRestfulController")
@RequestMapping("/resumeProfessionalSkills/")
@Validated
public class ResumeProfessionalSkillsController extends ApiManageController<ResumeProfessionalSkillsDTO,ResumeProfessionalSkillsPageDTO,ResumeProfessionalSkillsExt, ResumeProfessionalSkillsSearchExt,ResumeProfessionalSkillsDomainVO,ResumeProfessionalSkillsDetailDomainVO,ResumeProfessionalSkillsDetailVO,ResumeProfessionalSkillsListVO,String> {

	@Resource(name = "resumeProfessionalSkillsService")
	private IResumeProfessionalSkillsService resumeProfessionalSkillsService;

	@Resource
	private IResumeEsService resumeEsService;


	@Override
	public void afterPostAdd(ResumeProfessionalSkillsDTO dto, ResumeProfessionalSkillsExt domain, ResumeProfessionalSkillsDetailVO resumeProfessionalSkillsDetailVO, HttpServletRequest request, HttpSession session) throws SkException {
		super.afterPostAdd(dto, domain, resumeProfessionalSkillsDetailVO, request, session);
		resumeEsService.publishResumeProfessionalSkillsByResumeId(domain.getResumesId());
	}

	@Override
	public void afterPostMod(ResumeProfessionalSkillsDTO dto, ResumeProfessionalSkillsExt domain, SkJsonResult<ResumeProfessionalSkillsDetailVO> jsonResult, HttpServletRequest request, HttpSession session) throws SkException {
		super.afterPostMod(dto, domain, jsonResult, request, session);
		resumeEsService.publishResumeProfessionalSkillsByResumeId(domain.getResumesId());

	}

	@Override
	public IBaseService<ResumeProfessionalSkillsExt, ResumeProfessionalSkillsSearchExt,String> getBaseService() throws SkException {
		return resumeProfessionalSkillsService;
	}

	@Override
	public String getBaseRoute() {
		return "/resumeProfessionalSkills/";
	}

	/**
	* 当前模板名称
	* @return
	*/
	@Override
	public String getModelName(){
		return "专业技能";
	}

	@Override
	public Class exportExcelClass() {
		return ResumeProfessionalSkillsDomainExport.class;
	}

	@Override
	public Set<String> totalMapSet() {
		Set totalMapSet=new HashSet();
		totalMapSet.add("count(resume_professional_skills.rps_id) as countNum");
		return totalMapSet;
	}


}